<template>
  <!-- 推荐歌单详情页 顶部 -->
  <div class="ListViewTop">
    <img :src="playlist.coverImgUrl" class="bgImg" />
    <div class="nav">
      <div class="back">
        <span class="iconfont icon-zuojiantou" @click="$router.go(-1)"></span>
        <div class="title">歌单</div>
      </div>
      <div class="right">
        <span class="iconfont icon-sousuo"></span>
        <span class="iconfont icon-diandiandianshu"></span>
      </div>
    </div>

    <div class="content">
      <div class="contentLeft">
        <img :src="playlist.coverImgUrl" />
        <span>{{ changeValue(playlist.playCount) }}</span>
      </div>
      <div class="contentRight">
        <h3>{{ playlist.name }}</h3>
        <div class="author">
          <img :src="playlist.creator.avatarUrl" />
          <span>{{ playlist.creator.nickname }}</span>
        </div>
        <div class="description">
          {{ playlist.description }}
        </div>
      </div>
    </div>

    <div class="iconList">
      <div class="iconItem">
        <span class="iconfont icon-pinglun"></span>
        <span>{{ playlist.commentCount }}</span>
      </div>
      <div class="iconItem">
        <span class="iconfont icon-fenxiang"></span>
        <span>{{ playlist.shareCount }}</span>
      </div>
      <div class="iconItem">
        <span class="iconfont icon-xiazai"></span>
        <span>下载</span>
      </div>
      <div class="iconItem">
        <span class="iconfont icon-xuanze-duoxuan-tianchong"></span>
        <span>多选</span>
      </div>
    </div>
  </div>
</template>
    
<script>
export default {
  setup() {
    function changeValue(num) {
      let res = 0;
      if (num >= 100000000) {
        res = num / 100000000;
        // 保留两位小数
        res = res.toFixed(2) + "亿";
      } else if (num >= 10000) {
        res = num / 10000;
        res = res.toFixed(2) + "万";
      }
      return res;
    }
    return { changeValue };
  },
  components: {},
  props: ["playlist"],
};
</script>
    
<style lang="less" scoped>
.ListViewTop {
  width: 7.5rem;
  height: 6rem;
  padding: 0 0.4rem;
  .bgImg {
    position: fixed;
    left: 0;
    top: 0;
    width: 7.5rem;
    z-index: -1;
    filter: blur(40px); //模糊背景
  }
  .nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 1.2rem;
    font-size: 0.36rem;
    color: #fff;
    .iconfont {
      font-size: 0.48rem;
    }
    .back,
    .right {
      display: flex;
    }
    .title,
    .icon-diandiandianshu {
      margin-left: 0.26rem;
    }
  }
  .content {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    .contentLeft {
      position: relative;
      img {
        width: 2.8rem;
        height: 2.8rem;
        border-radius: 0.1rem;
      }
      span {
        color: #fff;
        position: absolute;
        right: 0.05rem;
        top: 0.05rem;
        font-size: 0.24rem;
      }
    }
    .contentRight {
      width: 3.5rem;
      h3 {
        color: #fff;
      }
      .author {
        display: flex;
        align-items: center;
        color: rgb(240, 240, 240);
        margin: 0.2rem 0;
        img {
          width: 0.6rem;
          height: 0.6rem;
          border-radius: 0.3rem;
          margin-right: 0.16rem;
        }
      }
      .description {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        font-size: 0.24rem;
        line-height: 0.4rem;
        color: rgb(240, 240, 240);
      }
    }
  }
  .iconList {
    display: flex;
    justify-content: space-around;
    .iconItem {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      align-items: center;
      color: rgb(240, 240, 240);
      font-size: 0.26rem;
      .iconfont {
        color: #fff;
        font-size: 0.4rem;
      }
    }
  }
}
</style>
    